package cn.shyouchi.wuguanjia.android.ui.splash;

import android.content.Intent;
import android.os.CountDownTimer;
import android.text.TextUtils;

import cn.shyouchi.wuguanjia.android.R;
import cn.shyouchi.wuguanjia.android.base.BaseActivity;
import cn.shyouchi.wuguanjia.android.components.storage.UserStorage;
import cn.shyouchi.wuguanjia.android.ui.home.security.SecurityMainActivity;
import cn.shyouchi.wuguanjia.android.ui.login.LoginActivity;

public class SplashActivity extends BaseActivity {


    @Override
    public int initContentView() {
        return R.layout.activity_splash;
    }

    @Override
    public void initInjector() {

    }

    @Override
    public void initUiAndListener() {
        new CountDownTimer(2000, 1000) {
            @Override
            public void onTick(long millisUntilFinished) {

            }

            @Override
            public void onFinish() {
                if (!TextUtils.isEmpty(new UserStorage(mContext).getToken())) {
                    startActivity(new Intent(mContext, SecurityMainActivity.class));
                } else {
                    startActivity(new Intent(mContext, LoginActivity.class));


//                    startActivity(new Intent(mContext, SecurityMainActivity.class));
                }
                finish();
            }
        }.start();
    }

    @Override
    protected boolean isApplyStatusBarTranslucency() {
        return true;
    }

    @Override
    protected boolean isApplyStatusBarColor() {
        return false;
    }
}
